//
//  PwdFoundParser.m
//  FootPrint
//
//  Created by 秦 东方 on 5/8/13.
//  Copyright (c) 2013 alex tao. All rights reserved.
//

#import "PwdFoundParser.h"

@implementation PwdFoundParser

- (void)reqPassword:(long long)phone{

    PasswordFoundRequestMessage_Builder* builder = [[PasswordFoundRequestMessage builder]setPhone:phone];
    
    NSData* queryData = [[builder build]data];
    
    if(queryData){
        
        [super noCacheRequestURL:URL_PWD_FOUND postData:queryData completion:^(NSData* resultData){
            @try {
                PasswordFoundResponseMessage* resp = [PasswordFoundResponseMessage parseFromData:resultData];
                [_delegate didFinishPwd:resp];
            }
            @catch (NSException *exception) {
                [_delegate failPwd];
            }
            
        } fail:^(NSError * err) {
            [_delegate failPwd];
        }];
        
    } else {
        [_delegate failPwd];
    }

}

@end
